<template>
  <div>
    <el-row type="flex" :gutter="20" style="padding-left: 20px">
      <h2 class="subtitle" style="margin-top: 20px; margin-left: 5px">湛江风电公司0点电量报表</h2>
    </el-row>
    <div style="height: auto;margin: 0 10px">
      <iframe  id="reportFrame" scrolling="no" frameborder="0" width="100%" height="100%" :src="src"></iframe>
<!--      <iframe v-show="this.$store.state.user.role===''" id="reportFrame" scrolling="no" frameborder="0" width="100%" height="100%" :src="src"></iframe>-->
<!--      <iframe v-show="this.$store.state.user.role===''" id="reportFrame0" scrolling="no" frameborder="0" width="100%" height="100%" :src="src"></iframe>-->
    </div>
  </div>
</template>

<script>
import { reportURL } from '@/config/baseConfig'

export default {
  name: 'index',
  data () {
    return {
      src: reportURL + 'productionDailyReport%252FdailyCompanyTime0Power.cpt' + '&op=write' + '&username=' + encodeURI(encodeURI(this.$store.state.user.username)),
      src0: reportURL + 'productionDailyReport%252FdailyCompanyTime0Power.cpt' + '&__bypagesize__=false' + '&username=' + encodeURI(encodeURI(this.$store.state.user.username))
    }
  },
  methods: {
  },
  mounted () {
    console.log(this.$store.state.user.role)
    const oIframe = document.getElementById('reportFrame')
    const deviceWidth = Number(document.documentElement.clientWidth)
    const deviceHeight = Number(document.documentElement.clientHeight)
    oIframe.style.width = (deviceWidth - 200) / deviceWidth * 100 + 'vw' // 数字是页面布局宽度差值
    oIframe.style.height = (deviceHeight - 200) / deviceHeight * 100 + 'vh' // 数字是页面布局高度差

    const oIframe0 = document.getElementById('reportFrame0')
    const deviceWidth0 = Number(document.documentElement.clientWidth)
    const deviceHeight0 = Number(document.documentElement.clientHeight)
    oIframe0.style.width = (deviceWidth0 - 200) / deviceWidth0 * 100 + 'vw' // 数字是页面布局宽度差值
    oIframe0.style.height = (deviceHeight0 - 200) / deviceHeight0 * 100 + 'vh' // 数字是页面布局高度差
  }
}
</script>

<style scoped>

</style>
